<html>

<head>
<title>SQL Relay - Getting Started With Sybase</title>
<link rel="stylesheet" href="../css/styles.css">
</head>

<body>

<span class="heading1">Getting Started With Sybase</span><br>

<ul>
<li><a href="#installation">Installation</a></li>
<ul>
<li><a href="#rpmversions">RPM-based Installations</a>
<ul>
<li><a href="#debian">Debian Linux</a></li>
<li><a href="#slackware">Slackware Linux</a></li>
<li><a href="#rpm">RPM-based Linux</a></li>
</ul>
<li><a href="#nonrpmversions">Non RPM-based Installations</a>
<li><a href="#creating">Creating a Database</a></li>
<li><a href="#accessing">Accessing a Database</a></li>
<li><a href="#sqlrelay">Accessing a Database With SQL Relay</a></li>
</ul>

<a name="installation"></a>
<span class="heading1">Installation</span><br>

<p>I've successfully installed and used Sybase Adaptive Server Enterprise 
versions 15.0.2, 12.5.2, 12.5.1, 11.9.2 and 11.0.3.3 on Linux.</p>

<p>You can download Sybase ASE from the 
<a href="http://www.sybase.com/downloads">downloads section</a> of the Sybase 
site.</p>

<a name="rpmversions"></a>
<span class="heading2">RPM-based Installations</span><br>

<p>Versions 12.5, 11.9.2 and 11.0.3.3 come as a set of RPM's for Linux.</p>

<a name="debian"></a>
<span class="heading3">Debian Linux</span><br>

<p>The best way to install RPM-based versions of Sybase ASE on Debian Linux
is to install <i>alien</i> and then use it to convert the Sybase RPM's to DEB
files and install them with <i>dpkg</i>.  On newer Debian releases, if you have
configured <i>apt</i> as illustrated in 
<a href="http://www.debian.org/doc/manuals/apt-howto/index.en.html">the 
APT-HOWTO</a>, run <i>apt-get install alien</i>.  If your distribution came
with <i>alien</i>, you may be prompted to enter a CD.  If not, it will be
downloaded from the internet.  Once <i>alien</i> is installed, log in as root
and use <i>alien</i> to convert the RPM's to DEB's and subsequently install the
DEB's as follows:</p>

<p>For version 12.5:</p>
<blockquote>
alien --to-deb sybase-openclient-12.5.0.1ESD-1.i386.rpm<br>
alien --to-deb sybase-common-12.5.0.1DE-1.i386.rpm<br>
alien --to-deb sybase-ase-12.5.0.1ESD-1.i386.rpm<br>
dpkg -i sybase-openclient-12.5.0.1ESD-1.i386.deb<br>
dpkg -i sybase-common-12.5.0.1DE-1.i386.deb<br>
dpkg -i sybase-ase-12.5.0.1ESD-1.i386.deb<br>
</blockquote>

<p>For version 11.9.2:</p>
<blockquote>
alien --to-deb sybase-openclient-11.1.1-3.i386.rpm<br>
alien --to-deb sybase-common-11.9.2-3.i386.rpm<br>
alien --to-deb sybase-ase-11.9.2-3.i386.rpm<br>
dpkg -i sybase-openclient-11.1.1-3.i386.deb<br>
dpkg -i sybase-common-11.9.2-3.i386.deb<br>
dpkg -i sybase-ase-11.9.2-3.i386.deb<br>
</blockquote>

<p>For version 11.0.3.3:</p>
<blockquote>
alien --to-deb sybase-ase-11_0_3_3-6_i386.rpm<br>
alien --to-deb sybase-ocsd-11_0_3_3-6_i386.rpm<br>
alien --to-deb sybase-doc-11_0_4-6_i386.rpm<br>
dpkg -i sybase-ase-11_0_3_3-6_i386.deb<br>
dpkg -i sybase-ocsd-11_0_3_3-6_i386.deb<br>
dpkg -i sybase-doc-11_0_4-6_i386.deb<br>
</blockquote>

<a name="slackware"></a>
<span class="heading3">Slackware Linux</span><br>

<p>The easiest way to install RPM-based versions Sybase ASE on Slackware Linux
is to install RPM and then use it to install the RPM's.  The RPM package is
available from <a href="ftp://ftp.slackware.com">ftp.slackware.com</a>.  You
can install it using <i>installpkg</i>.  Once RPM is installed, log in as root
and run <i>rpm --initdb</i> as root.  Then, you can follow the directions below
for installing on RPM Based Linux.  The only difference is that you must use 
<i>rpm -i --nodeps</i> instead of <i>rpm -i</i> to install the RPM's.</p>

<a name="rpm"></a>
<span class="heading3">RPM-based Linux</span><br>

<p>Versions 11.9.2 and 11.0.3.3 of Sybase ASE for Linux require glibc version
2.1.2 or greater.  I was able to install them both on RedHat 6.2, 7.3 and 9.
I was not able to install them on Redhat 5.2.</p>

<span class="heading4">Version 11.9.2</span><br>

<p>To install version 11.9.2 on RPM Based Linux, you should download the
following RPMS (at minimum) and install them using <i>rpm -i</i>.  Note that
while it is possible to have RPMS for versions 11.9.2 and 12.5 installed
simultaneously, it will cause problems for both versions.  Install one or the
other, but not both.</p>

<blockquote><b>
sybase-openclient-11.1.1-3<br>
sybase-common-11.9.2-3<br>
sybase-ase-11.9.2-3<br>
</b></blockquote>

<p>The other RPMS provide documentation and localization support for several
languages.</p>

<p>During RPM installation, a sybase user will be created.  You should give
this user a password.</p>

<span class="heading4">Version 11.0.3.3</span><br>

<p>To install version 11.0.3.3 on RPM Based Linux, you should download the
following RPMS (at minimum) and install them using <i>rpm -i</i>.</p>

<blockquote><b>
sybase-ase-11.0.3.3-6<br>
sybase-ocsd-11.0.3.3-6<br>
</b></blockquote>

<p>The other RPMS provide documentation and localization support for several
languages.</p>

<p>Version 11.0.3.3 does not create a sybase user when the RPMS are installed.
After installation, you must run the following commands as root.

<blockquote><b>
export SYBASE=/opt/sybase<br>
/opt/sybase/install/sybinstall.sh<br>
</b></blockquote>

<p>Answer Yes or y to all questions.  The script will create a sybase user and 
prompt you for a password.</p>

<a name="nonrpmversions"></a>
<span class="heading2">Non RPM-based Installations</span><br>

<p>Sybase provides tarballs for versions 15.0.2, 12.5.2 and 12.5.1 for Linux.
In versions 12.5.2 and 12.5.1, installation and database creation are done in a
single step.  For instructions for installing versions 12.5.2 and 12.5.1, see
the instructions below for creating a database.</p>

<a name="creating"></a>
<span class="heading1">Creating a Database</span><br>

<p>Some newer Linux Distributions set the LANG environment variable to a value
that is not supported by Sybase ASE prior to 15.0.2.  For example,
LANG=en_US.iso885915 on
Redhat 7.3.  Check the value of the LANG environment variable, and if necessary,
set it to something that is defined in the locales.dat file
(/opt/sybase-11.9.2/locales/locales.dat for sybase-11.9.2) such as en_US for
US-english.</p>

<p>The instructions for initializing each version are very different.</p>

<p>See <a href="sybase/15.0.2.html">Initializing a 15.0.2 server</a>,
<a href="sybase/12.5.2.html">Initializing a 12.5.2 server</a>,
<a href="sybase/12.5.1.html">Initializing a 12.5.1 server</a>,
<a href="sybase/12.5.html">Initializing a 12.5 server</a>,
<a href="sybase/11.9.2.html">Initializing an 11.9.2 server</a> and
<a href="sybase/11.0.3.3.html">Initializing an 11.0.3.3 server</a>.

<p>Once you have initialized the server, you should start the server.  From
this point on, the database creation process is the same for all versions.</p>

<p>At this point, you should set up your environment.  The Sybase client is
called </i>isql</i>.  Note that <i>unixODBC</i> and <i>Interbase/Firebird</i>
have a client called <i>isql</i> as well which could be installed in /usr/bin,
/usr/local/bin or some other path.  If you have <i>unixODBC</i> or
<i>Interbase/Firebird</i> installed, you'll have to decide which client you
want the <i>isql</i> command to run.  If you want it to run the Sybase client,
follow the instructions below.  Otherwise, you'll have to run the Sybase
<i>isql</i> client by its full pathname which could be
/opt/sybase/OCS-15_0/bin/isql, /opt/sybase/OCS/bin/isql,
/opt/sybase-12.5/OCS/bin/isql, /opt/sybase-11.9.2/bin/isql
or some other path.</p>

<p>In the configuration script for your shell, add the path to the Sybase isql
client to your PATH environment variable as follows.  In these examples,
/opt/sybase-11.9.2/bin is used, but your Sybase isql client may be installed
elsewhere.</p>

<p>For Bourne shells:</p>

<blockquote>
<PRE>
<FONT color=#008a8e>PATH</FONT>=<FONT color=#a620f7>$PATH</FONT>:/opt/sybase/OCS/bin
<B><FONT color=#a62828>export </FONT></B><FONT color=#008a8e>PATH</FONT>
</PRE>
</blockquote>

<p>For C-shells:</p>

<blockquote>
<PRE>
<B><FONT color=#a62828>setenv</FONT></B> <FONT color=#6959cf>PATH</FONT> <B><FONT color=#288a51>${PATH}</FONT></B>:/opt/sybase/OCS/bin
</PRE>
</blockquote>

<p>Now log out and log back in and you can access the database using the 
<i>isql</i> client. 

<p>The initialization process should have created a server named 
<i>LOCALHOST</i> (or <i>localhost</i> for version 11.9.2 or earlier) with an
administrative user named <i>sa</i> which has no password.</p>

<p>To set the administrative user's password, log into the database with the
following command.  When it prompts you for a password, just press return.</p>

<blockquote>
For Sybase 12.5 or later:

<blockquote>
<b>isql -U sa -S LOCALHOST</b>
</blockquote>

For Sybase 11.9.2 or earlier:

<blockquote>
<b>isql -U sa -S localhost</b>
</blockquote>

</blockquote>

<p>At the prompt, run the following stored procedure to give <i>sa</i> the
password <i>sapassword</i>.</p>

<blockquote>
<pre>
sp_password <font color="#6a5acd">null</font>,<font color="#ff00ff">&quot;sapassword&quot;</font>,<font color="#ff00ff">&quot;sa&quot;</font>
go
</pre>
</blockquote>

<p>Now logout.</p>

<blockquote>
<b>quit</b>
</blockquote>

<p>Log back in using the following command.  When it promts you for a password,
type <i>sapassword</i>.</p>

<blockquote>
For Sybase 12.5 or later:

<blockquote>
<b>isql -U sa -S LOCALHOST</b>
</blockquote>

For Sybase 11.9.2 or earlier:

<blockquote>
<b>isql -U sa -S localhost</b>
</blockquote>

</blockquote>

<p>Though you could create your own tables using the <i>sa</i> user and the 
system database, it's not a good idea.  You should create a user database.
The following commands create a database named <i>testdb</i>.</p>

<blockquote>
<PRE>
<B><FONT color=#a62828>create</FONT></B> database testdb
go
quit
</PRE>
</blockquote>

<p>Now log into the database you just created with the following command.</p>

<blockquote>
For Sybase 12.5 or later:

<blockquote>
<b>isql -U sa -S LOCALHOST -D testdb</b>
</blockquote>

For Sybase 11.9.2 or earlier:

<blockquote>
<b>isql -U sa -S localhost -D testdb</b>
</blockquote>

</blockquote>

<p>Creating a user is a 2 step process.  First a universal login must be 
created, then it must be added as a user to a particular database.  
Execute the following stored procedures and queries to create a login 
named <i>testuser</i> with password <i>testpassword</i>, add it as a user of 
<i>testdb</i> and give it all permissions.</p>

<blockquote>
<PRE>
sp_addlogin <FONT color=#ff00ff>&quot;testuser&quot;</FONT>,<FONT color=#ff00ff>&quot;testpassword&quot;</FONT>
go
sp_adduser <FONT color=#ff00ff>&quot;testuser&quot;</FONT>
go
<B><FONT color=#a62828>grant</FONT></B> <B><FONT color=#a62828>all</FONT></B> <FONT color=#6959cf>to</FONT> testuser
go
quit
</PRE>
</blockquote>

<p>Now you can log in as <i>testuser</i> using the following command.  When
promted for a password, enter <i>testpassword</i>.</p>

<blockquote>
For Sybase 12.5 or later:

<blockquote>
<b>isql -U testuser -S LOCALHOST -D testdb</b>
</blockquote>

For Sybase 11.9.2 or earlier:

<blockquote>
<b>isql -U testuser -S localhost -D testdb</b>
</blockquote>

</blockquote>

<p>A common problem when using Sybase ASE in this minimal configuration is 
running out of log space.  If you run out of log space, queries will hang until
space is freed up.  You might get an error like this:</p>

<blockquote><b>
The transaction log in database testdb is almost full.  Your transaction is<br>
being suspended until space is made available in the log.
</b></blockquote>

<p>To dump the log, log into the master database as the <i>sa</i> user as 
follows.  When it promts you for a password, type <i>sapassword</i>.</p>

<blockquote>
For Sybase 12.5 or later:


<blockquote>
<b>isql -U testuser -S LOCALHOST -D testdb</b>
</blockquote>

For Sybase 11.9.2 or earlier:

<blockquote>
<b>isql -U testuser -S localhost -D testdb</b>
</blockquote>

</blockquote>

<p>Once logged in, execute the following series of commands.</p>

<blockquote>
<PRE>
dump tran testdb <FONT color=#6959cf>with</FONT> no_log
go
</PRE>
</blockquote>

<p>This should be enough to get you started.  To set up more complex 
configurations, consult the Sybase ASE documentation.</p>

<a name="accessing"></a>
<span class="heading1">Accessing a Database</span><br>

<p>Some newer Linux Distributions set the LANG environment variable to a value
that is not supported by Sybase ASE.  For example, LANG=en_US.iso885915 on
Redhat 7.3.  If isql fails to start, and complains about the LANG environment variable, set it to something that is defined in the locales.dat file
(/opt/sybase-11.9.2/locales/locales.dat for sybase-11.9.2) such as en_US for
US-english.</p>

<p>The first step in accessing a Sybase ASE database is setting up your 
environment.  The Sybase client is called <i>isql</i>.  Note that 
<i>unixODBC</i> and <i>Interbase</i> both have clients called <i>isql</i> 
as well which could be installed in /usr/bin, /usr/local/bin or 
/opt/interbase/bin.  If you have <i>unixODBC</i> or <i>Interbase</i> installed, 
you'll have to decide which client you want the <i>isql</i> command to run.  If 
you want it to run the Sybase client, follow the instructions below.  
Otherwise, you'll have to run the Sybase <i>isql</i> client by its full 
pathname.</p>

<p>In the configuration script for whatever shell you use, create an 
environment variable called SYBASE containing the directory you intalled Sybase
ASE in.  Then add <i>$SYBASE/bin</i> to your PATH environment variable.</p>

<p>For Bourne shells:</p>

<blockquote>
<PRE>
<FONT color=#008a8e>SYBASE</FONT>=/opt/sybase<FONT color=#ff00ff>-11</FONT>.<FONT color=#ff00ff>9</FONT>.<FONT color=#ff00ff>2</FONT>
<FONT color=#008a8e>PATH</FONT>=<FONT color=#a620f7>$PATH</FONT>:<FONT color=#a620f7>$SYBASE</FONT>/bin
<B><FONT color=#a62828>export </FONT></B><FONT color=#008a8e>SYBASE PATH</FONT>
</PRE>
</blockquote>

<p>For C-shells:</p>

<blockquote>
<PRE>
<B><FONT color=#a62828>setenv</FONT></B> <FONT color=#6959cf>SYBASE</FONT> /opt/sybase<FONT color=#ff00ff>-11</FONT>.<FONT color=#ff00ff>9</FONT>.<FONT color=#ff00ff>2</FONT>
<B><FONT color=#a62828>setenv</FONT></B> <FONT color=#6959cf>PATH</FONT> <B><FONT color=#288a51>${PATH}</FONT></B>:<B><FONT color=#288a51>${SYBASE}</FONT></B>/bin
</PRE>
</blockquote>

<p>Now, if you log out and log back in, you can access the database using the 
<i>isql</i> client.</p>

<p><i>isql</i> requires a <b>username</b>, <b>server</b> and <b>database</b> 
name to access a database.  The <b>server</b> parameter does not refer to the
hostname of the machine you want to connect to, but rather to an entry in the
<i>$SYBASE/interfaces</i> file.  When a database is created, the process puts 
an entry in the <i>$SYBASE/interfaces</i> file on the machine the database was 
created on.  This entry can then be copied into the <i>$SYBASE/interfaces</i>
file on other machines to provide them remote access to the database.  Below is
a sample entry for a server named <i>REMOTEHOST</i> which refers to an instance 
of Sybase ASE running on <i>testhost.testdomain.com</i>, on port 4100, 
accessible over tcp on ethernet and a similar entry for a server named 
<i>LOCALHOST</i> which is running on <i>localhost</i>.</p>

<blockquote>
<pre><b>
REMOTEHOST
	master tcp ether testhost.testdomain.com 4100
	query tcp ether testhost.testdomain.com 4100

LOCALHOST
	master tcp ether localhost 4100
	query tcp ether localhost 4100
</b></pre>
</blockquote>

<p>Similar entries can be made to access servers running on other hosts.</p>

<p>To access the database <i>testdb</i> on the server <i>LOCALHOST</i> as the
user <i>testuser</i>, run the following command.</p>

<blockquote>
<b>isql -U testuser -S LOCALHOST -D testdb</b>
</blockquote>

<p>Once you're connected to the database, the <i>isql</i> client prompts you
to enter a query.  Queries may be split across multiple lines.  To run a query,
type go on a line by itself.  To exit, type quit on a line by itself.</p>

<p>A sample <i>isql</i>session follows.</p>

<blockquote>
<PRE>
[user@localhost user]$ /opt/sybase/OCS/bin/isql -U testuser -S LOCALHOST -D testdb
Password: 
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>create</FONT></B> <FONT color=#6959cf>table</FONT> testtable (
<FONT color=#ff00ff>2</FONT>&gt; col1 <B><FONT color=#288a51>char</FONT></B>(<FONT color=#ff00ff>40</FONT>),
<FONT color=#ff00ff>3</FONT>&gt; col2 <B><FONT color=#288a51>integer</FONT></B>
<FONT color=#ff00ff>4</FONT>&gt; )
<FONT color=#ff00ff>5</FONT>&gt; go
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>select</FONT></B> name <FONT color=#6959cf>from</FONT> sysobjects <FONT color=#6959cf>where</FONT> <FONT color=#6959cf>type</FONT>=<FONT color=#ff00ff>'U'</FONT>
<FONT color=#ff00ff>2</FONT>&gt; go
 name                           
 <FONT color=#0000ff>------------------------------ </FONT>
 testtable                      

(<FONT color=#ff00ff>1</FONT> row affected)
<FONT color=#ff00ff>1</FONT>&gt; sp_help testtable
<FONT color=#ff00ff>2</FONT>&gt; go
 Name                           Owner                         
         Type
 <FONT color=#0000ff>------------------------------ ------------------------------ ---------------------- </FONT>
 testtable                      testuser                      <FONT color=#6959cf>user</FONT> <FONT color=#6959cf>table</FONT>             

(<FONT color=#ff00ff>1</FONT> row affected)
 Data_located_on_segment        When_created               
 <FONT color=#0000ff>------------------------------ -------------------------- </FONT>
 <FONT color=#6959cf>default</FONT>                               Jan <FONT color=#ff00ff>14</FONT> <FONT color=#ff00ff>2002</FONT> 12:24PM 
 Column_name     Type            Length Prec Scale Nulls Default_name   
         Rule_name       Identity 
 <FONT color=#0000ff>--------------- --------------- ------ ---- ----- ----- --------------- --------------- -------- </FONT>
 col1            <B><FONT color=#288a51>char</FONT></B>                <FONT color=#ff00ff>40</FONT> <FONT color=#6959cf>NULL</FONT>  <FONT color=#6959cf>NULL</FONT>     <FONT color=#ff00ff>0</FONT> <FONT color=#6959cf>NULL</FONT>           <FONT color=#6959cf>NULL</FONT>                   <FONT color=#ff00ff>0</FONT> 
 col2            int                  <FONT color=#ff00ff>4</FONT> <FONT color=#6959cf>NULL</FONT>  <FONT color=#6959cf>NULL</FONT>     <FONT color=#ff00ff>0</FONT> <FONT color=#6959cf>NULL</FONT>           <FONT color=#6959cf>NULL</FONT>                   <FONT color=#ff00ff>0</FONT> 
Object does not have any indexes.
No defined keys for this object.
Object is not partitioned.
Lock scheme Allpages
The attribute <FONT color=#ff00ff>'exp_row_size'</FONT> is not applicable to tables with allpages lock scheme.
 
 exp_row_size reservepagegap fillfactor max_rows_per_page 
 <FONT color=#0000ff>------------ -------------- ---------- ----------------- </FONT>
            <FONT color=#ff00ff>1</FONT>              <FONT color=#ff00ff>0</FONT>          <FONT color=#ff00ff>0</FONT>                 <FONT color=#ff00ff>0</FONT> 
(<FONT color=#6959cf>return</FONT> status = <FONT color=#ff00ff>0</FONT>)
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>insert</FONT></B> <FONT color=#6959cf>into</FONT> testtable <FONT color=#6959cf>values</FONT> (<FONT color=#ff00ff>'hello'</FONT>,<FONT color=#ff00ff>50</FONT>)
<FONT color=#ff00ff>2</FONT>&gt; go
(<FONT color=#ff00ff>1</FONT> row affected)
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>insert</FONT></B> <FONT color=#6959cf>into</FONT> testtable <FONT color=#6959cf>values</FONT> (<FONT color=#ff00ff>'hi'</FONT>,<FONT color=#ff00ff>60</FONT>)
<FONT color=#ff00ff>2</FONT>&gt; go
(<FONT color=#ff00ff>1</FONT> row affected)
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>insert</FONT></B> <FONT color=#6959cf>into</FONT> testtable <FONT color=#6959cf>values</FONT> (<FONT color=#ff00ff>'bye'</FONT>,<FONT color=#ff00ff>70</FONT>)
<FONT color=#ff00ff>2</FONT>&gt; go
(<FONT color=#ff00ff>1</FONT> row affected)
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>select</FONT></B> * <FONT color=#6959cf>from</FONT> testtable
<FONT color=#ff00ff>2</FONT>&gt; go
 col1                                     col2        
 <FONT color=#0000ff>---------------------------------------- ----------- </FONT>
 hello                                             <FONT color=#ff00ff>50</FONT> 
 hi                                                <FONT color=#ff00ff>60</FONT> 
 bye                                               <FONT color=#ff00ff>70</FONT> 

(<FONT color=#ff00ff>3</FONT> rows affected)
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>update</FONT></B> testtable <B><FONT color=#a62828>set</FONT></B> col2=<FONT color=#ff00ff>0</FONT> <FONT color=#6959cf>where</FONT> col1=<FONT color=#ff00ff>'hi'</FONT>
<FONT color=#ff00ff>2</FONT>&gt; go
(<FONT color=#ff00ff>1</FONT> row affected)
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>select</FONT></B> * <FONT color=#6959cf>from</FONT> testtable
<FONT color=#ff00ff>2</FONT>&gt; go
 col1                                     col2        
 <FONT color=#0000ff>---------------------------------------- ----------- </FONT>
 hello                                             <FONT color=#ff00ff>50</FONT> 
 hi                                                 <FONT color=#ff00ff>0</FONT> 
 bye                                               <FONT color=#ff00ff>70</FONT> 

(<FONT color=#ff00ff>3</FONT> rows affected)
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>delete</FONT></B> <FONT color=#6959cf>from</FONT> testtable <FONT color=#6959cf>where</FONT> col2=<FONT color=#ff00ff>50</FONT>
<FONT color=#ff00ff>2</FONT>&gt; go
(<FONT color=#ff00ff>1</FONT> row affected)
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>select</FONT></B> * <FONT color=#6959cf>from</FONT> testtable
<FONT color=#ff00ff>2</FONT>&gt; go
 col1                                     col2        
 <FONT color=#0000ff>---------------------------------------- ----------- </FONT>
 hi                                                 <FONT color=#ff00ff>0</FONT> 
 bye                                               <FONT color=#ff00ff>70</FONT> 

(<FONT color=#ff00ff>2</FONT> rows affected)
<FONT color=#ff00ff>1</FONT>&gt; <B><FONT color=#a62828>drop</FONT></B> <FONT color=#6959cf>table</FONT> testtable
<FONT color=#ff00ff>2</FONT>&gt; go
<FONT color=#ff00ff>1</FONT>&gt; quit
</PRE>
</blockquote>

<a name="sqlrelay"></a>
<span class="heading1">Accessing a Database With SQL Relay</span><br>

<p>Accessing Sybase from SQL Relay requires an instance entry in your 
<i>sqlrelay.conf</i> file for the database that you want 
to access.  Here is an example <i>sqlrelay.conf</i> which defines an SQL Relay 
instance called sybasetest.  This instance connects to the <i>testdb</i> 
database on the server <i>LOCALHOST</i> as the user <i>testuser</i> with 
password <i>testpassword</i>.</p>

<PRE>
<FONT color=#0000ff>&lt;?</FONT><B><FONT color=#288a51>xml version=</FONT></B><FONT color=#ff00ff>&quot;1.0&quot;</FONT><FONT color=#0000ff>?&gt;</FONT>
<FONT color=#008a8e>&lt;!</FONT><B><FONT color=#a62828>DOCTYPE</FONT></B> instances <B><FONT color=#a62828>SYSTEM</FONT></B> <FONT color=#ff00ff>&quot;sqlrelay.dtd&quot;</FONT><FONT color=#008a8e>&gt;</FONT>
<FONT color=#008a8e>&lt;instances&gt;</FONT>

        <FONT color=#008a8e>&lt;instance id=</FONT><FONT color=#ff00ff>&quot;sybasetest&quot;</FONT><FONT color=#008a8e> port=</FONT><FONT color=#ff00ff>&quot;9000&quot;</FONT><FONT color=#008a8e> socket=</FONT><FONT color=#ff00ff>&quot;/tmp/sybasetest.socket&quot;</FONT><FONT color=#008a8e> dbase=</FONT><FONT color=#ff00ff>&quot;sybase&quot;</FONT><FONT color=#008a8e> connections=</FONT><FONT color=#ff00ff>&quot;3&quot;</FONT><FONT color=#008a8e> maxconnections=</FONT><FONT color=#ff00ff>&quot;5&quot;</FONT><FONT color=#008a8e> maxqueuelength=</FONT><FONT color=#ff00ff>&quot;0&quot;</FONT><FONT color=#008a8e> growby=</FONT><FONT color=#ff00ff>&quot;1&quot;</FONT><FONT color=#008a8e> ttl=</FONT><FONT color=#ff00ff>&quot;60&quot;</FONT><FONT color=#008a8e> endofsession=</FONT><FONT color=#ff00ff>&quot;commit&quot;</FONT><FONT color=#008a8e> sessiontimeout=</FONT><FONT color=#ff00ff>&quot;600&quot;</FONT><FONT color=#008a8e> runasuser=</FONT><FONT color=#ff00ff>&quot;nobody&quot;</FONT><FONT color=#008a8e> runasgroup=</FONT><FONT color=#ff00ff>&quot;nobody&quot;</FONT><FONT color=#008a8e> cursors=</FONT><FONT color=#ff00ff>&quot;5&quot;</FONT><FONT color=#008a8e> authtier=</FONT><FONT color=#ff00ff>&quot;listener&quot;</FONT><FONT color=#008a8e> handoff=</FONT><FONT color=#ff00ff>&quot;pass&quot;</FONT><FONT color=#008a8e>&gt;</FONT>
                <FONT color=#008a8e>&lt;users&gt;</FONT>
                        <FONT color=#008a8e>&lt;user user=</FONT><FONT color=#ff00ff>&quot;sybasetest&quot;</FONT><FONT color=#008a8e> password=</FONT><FONT color=#ff00ff>&quot;sybasetest&quot;</FONT><FONT color=#008a8e>/&gt;</FONT>
                <FONT color=#008a8e>&lt;/users&gt;</FONT>
                <FONT color=#008a8e>&lt;connections&gt;</FONT>
                        <FONT color=#008a8e>&lt;connection connectionid=</FONT><FONT color=#ff00ff>&quot;sybasetest&quot;</FONT><FONT color=#008a8e> string=</FONT><FONT color=#ff00ff>&quot;server=LOCALHOST;db=testdb;user=testuser;password=testpassword;&quot;</FONT><FONT color=#008a8e> metric=</FONT><FONT color=#ff00ff>&quot;1&quot;</FONT><FONT color=#008a8e>/&gt;</FONT>
                <FONT color=#008a8e>&lt;/connections&gt;</FONT>
        <FONT color=#008a8e>&lt;/instance&gt;</FONT>

<FONT color=#008a8e>&lt;/instances&gt;</FONT>
</PRE>

<p>Now you can start up this instance with the following command.</p>

<blockquote>
<b>sqlr-start -id sybasetest</b>
</blockquote>

<p>Note that there are a couple of common problems people have with the Sybase
connection.  See the <a href="../faq.html">FAQ</a> and the
<a href="../running.html#problems">common problems</a> section of the document
on running SQL Relay for more info.</p>

<p>To connect to the instance and run queries, use the following command.</p>

<blockquote>
<b>sqlrsh -id sybasetest</b>
</blockquote>

<p>The following command shuts down the SQL Relay instance.</p>

<blockquote>
<b>sqlr-stop sybasetest</b>
</blockquote>

</body>

</html>
